<?php
namespace app\admin\model;

use think\Model;
use think\Session;

class Users extends Model
{
    //设置默认主键
    protected $pk = 'id';
    protected $updateTime = 'login_time';

    /**
     * 用户登陆
     */
    public function Login($post){
        $user = self::get(['username|email'=>$post['username'],'password'=>md5($post['password'])]);
        //获取登陆资料，并且加入session中
        Session::set('user',$user->toArray());
        return $user;
    }
}